<link rel="stylesheet" href="${ctx}/static/css/bootstrap.min.css"/>
<link rel="stylesheet" href="${ctx}/static/css/bootstrap-theme.css"/>
<script type="text/javascript" src="${ctx}/static/js/bootstrap.min.js"></script>
<script>
    $(function () {
        $("#offerType").combobox({
            onSelect: function (record) {
                if (record.text == '阶梯按单' || record.text == '阶梯比例') {
                    $("#linjie").show();
                } else {
                    $("#linjie").hide();
                }
            }
        });

        $(":radio").click(function() {
            var selectVal = $(this).val();
            if(selectVal == 1) {
                $("#cardDiff").show();
                $("#price").hide();
            } else if(selectVal == 0) {
                $("#cardDiff").hide();
                $("#price").show();
            } else if(selectVal == "是") {
                $("#priceRestrain").show();
            } else if(selectVal == "否") {
                $("#priceRestrain").hide();
            }
        });
    });
</script>
<form id="channel_form" method="post">
    <table class="table">
        <input type="hidden" name="companyId" value="${companyId}"
        <tr>
            <td>产品名称：</td>
            <td>
                <select id="productName" class="easyui-combobox" name="productName" style="width:200px;">
                <@dict type="channel">
                    <#list labels as label>
                        <option value="${label.label_value}">${label.label_name}</option>
                    </#list>
                </@dict>
                </select>
            </td>
            <td>支付场景：</td>
            <td>
                <select id="payScene" class="easyui-combobox" name="payScene" style="width:200px;">
                <@dict type="gsxz">
                    <#list labels as label>
                        <option value="${label.label_value}">${label.label_name}</option>
                    </#list>
                </@dict>
                </select>
            </td>
        </tr>
        <tr>
            <td>支付设备：</td>
            <td>
                <select id="deviceName" class="easyui-combobox" name="deviceName" style="width:200px;">
                <@dict type="sysb">
                    <#list labels as label>
                        <option value="${label.label_value}">${label.label_name}</option>
                    </#list>
                </@dict>
                </select>
            </td>
            <td>报价方式：</td>
            <td>
                <select id="offerType" class="easyui-combobox" name="offerType" style="width:200px;">
                    <option value="1">固定按单</option>
                    <option value="2">固定比例</option>
                    <option value="3">阶梯按单</option>
                    <option value="4">阶梯比例</option>
                </select>
            </td>
        </tr>
        <tr hidden="hidden" id="linjie">
            <td>临界价格：</td>
            <td colspan="3">
                <div id="criticalValue" style="float: left"></div>
                <input class="easyui-validatebox" type="text" name="criticalValue" style="width: 200px;" />
            </td>
        </tr>
        <tr>
            <td>银行卡差异：</td>
            <td>
                <input type="radio" name="cardDiff" id="cardDiff_yes" value="1" /><label for="cardDiff_yes">有</label>　
                <input type="radio" name="cardDiff" checked="checked" id="cardDiff_no" value="0" /><label for="cardDiff_no">无</label>
            </td>
            <td>封底封底:</td>
            <td>
                <input type="radio" name="priceRestrain" id="price_yes" value="是" /><label for="price_yes">是</label>　
                <input type="radio" name="priceRestrain" checked="checked" id="price_no" value="否" /><label for="price_no">否</label>
            </td>
        </tr>
        <tr id="price">
            <td>对外价格：</td>
            <td><input class="easyui-validatebox" type="text" name="offerPrice" data-options="required:true" /></td>
            <td>第三方价格：</td>
            <td><input class="easyui-validatebox" type="text" name="offerPartyPrice" data-options="required:true" /></td>
        </tr>

        <tr hidden="hidden" id="cardDiff">
            <td>借记卡：</td>
            <td><input class="easyui-validatebox" type="text" name="debitCard" data-options="required:true" /></td>
            <td>贷记卡：</td>
            <td><input class="easyui-validatebox" type="text" name="creditCard" data-options="required:true" /></td>
        </tr>
        <tr hidden="hidden" id="priceRestrain">
            <td>封顶价格：</td>
            <td><input class="easyui-validatebox" type="text" name="fengding" data-options="required:true" /></td>
            <td>封底价格：</td>
            <td><input class="easyui-validatebox" type="text" name="fengdi" data-options="required:true" /></td>
        </tr>
        <tr>
            <td>清算周期（Ｔ）：</td>
            <td><input class="easyui-numberspinner" name="accountTime" style="width:200px;" required="required"
                       data-options="min:0,max:100">
            </td>
            <td>接入条件：</td>
            <td><input class="easyui-validatebox" type="text" name="conditions" style="width:200px;"
                       data-options="required:true"/></td>
        </tr>
        <tr>
            <td>支持银行：</td>
            <td><input class="easyui-validatebox" type="text" name="supportBank" style="width:200px;"
                       data-options="required:true"/></td>
        <#--<td>上传详细：</td>
        <td><input class="easyui-validatebox" type="file" name="supportBankFile" style="width: 180px;" /> </td>-->
        </tr>
        <tr>
            <td colspan="2">
                <div align="center">
                    <button type="submit" class="easyui-linkbutton" data-options="iconCls:'icon-ok'">保存</button>
                </div>
            </td>
        </tr>
    </table>
</form>

<script type="text/javascript">
    $(function(){
        $("#channel_form").form({
            url :'${ctx}/offer/addChannel',
            onSubmit : function() {
                parent.$.messager.progress({
                    title : '提示',
                    text : '数据处理中，请稍后....'
                });
            },
            success : function(result) {
                parent.$.messager.progress('close');
                $.messager.show({
                    title : '提示信息',
                    msg : "操作成功，请刷新页面",
                    timeout : 1000 * 2
                });
            }
        });
    });
</script>